<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>重置密码</title>
<script type="text/javascript">
ResetPassword={
		checkPassword:function(){
			var newPassword=document.getElementById("newPassword").value;
			var newPasswordError=document.getElementById("newPasswordError");
			if(newPassword==""){
				newPasswordError.innerHTML="密码不能为空";
				return false;
			}else if(newPassword.length<6){
				newPasswordError.innerHTML="密码不能小于6位";
				return false;
			}else if(newPassword.length>32){
				newPasswordError.innerHTML="密码不能超过32位";
				return false;
			}else{
				newPasswordError.innerHTML="";
				return true;
			}
		},
		checkPasswordConfirm:function(){
			var newPassword=document.getElementById("newPassword").value;
			var newPasswordConfirm=document.getElementById("newPasswordConfirm").value;
			var newPasswordConfirmError=document.getElementById("newPasswordConfirmError");
			if(newPasswordConfirm==""){
				newPasswordConfirmError.innerHTML="密码不能为空";
				return false;
			}else if(newPasswordConfirm.length<6){
				newPasswordConfirmError.innerHTML="密码不能小于6位";
				return false;
			}else if(newPasswordConfirm.length>32){
				newPasswordConfirmError.innerHTML="密码不能超过32位";
				return false;
			}else if(newPasswordConfirm!=newPassword){
				newPasswordConfirmError.innerHTML="两次密码输入不一致";
				return false;
			}else{
				newPasswordConfirmError.innerHTML="";
				return true;
			}
		},
		reset:function(){
			if(ResetPassword.checkPassword()&&ResetPassword.checkPasswordConfirm()){
				var resetPasswordForm=document.getElementById("resetPasswordForm");
				resetPasswordForm.submit();
			}
		}
}
</script>
</head>
<body>
	<h1>重置密码</h1>
	<hr>
	<form id="resetPasswordForm" action="${pageContext.request.contextPath}/user/password/reset.html" method="post">
		<table>
		<tr>
			<td>新密码:</td>
			<td><input type="password" name="newPassword" id="newPassword" size="32" onblur="javascript:ResetPassword.checkPassword();"></td>
			<td><font id="newPasswordError" color="red"></font></td>
		</tr>
		<tr>
			<td>确认新密码:</td>
			<td><input type="password" name="newPasswordConfirm" id="newPasswordConfirm"size="32" onblur="javascript:ResetPassword.checkPasswordConfirm();"></td>
			<td><font id="newPasswordConfirmError" color="red"></font></td>
		</tr>
		<tr>
			<td colspan="2"><input type="button" onclick="javascript:ResetPassword.reset();" value="提交"> </td>
			<td></td>
		</tr>
		</table>
	</form>
</body>
</html>